/*
 * User: ophir
 * Date: Sep 11, 2008
 * Time: 10:39:36 AM
 */
package org.conann.metadata.records;

import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;

public class ConstructorParameter extends Parameter<Constructor<?>> {

    private final Constructor<?> constructor;

    public ConstructorParameter(int index, Constructor<?> constructor) {
        super(index, constructor.getParameterTypes()[index]);
        this.constructor = constructor;
    }

    public Annotation[] getAnnotations() {
        return constructor.getParameterAnnotations()[getIndex()];
    }

    public Constructor<?> getConstructor() {
        return constructor;
    }

    @Override
    protected Constructor<?> getElement() {
        return getConstructor();
    }

    @Override
    protected String getElementName() {
        return getConstructor().getName();
    }
}